extends Sprite

var _tag:String

func _on_mask_gui_input(event):
	if event is InputEventMouseButton:
		if event.pressed:
			# 按下
			onPresed()
			pass
		else:
			# 弹起
			var size = get_node("mask").rect_size
			var pos = event.position
			if pos.x >= 0 && pos.x <= size.x && pos.y >= 0 && pos.y <= size.y: 
				onReleased(true)
			else:
				onReleased(false)
			pass
		#print(event.button_index, event.pressed, event.position)
	pass # Replace with function body.
	
func onPresed():
	#print('pressed')
	pass
	
func onReleased(inside):
	if inside:
		Audio.playBtnEffect()
		Model.select.clear()
		Model.play.seekStory(_tag)
	#print('released - ', inside)
	
func setTitle(title : String):
	$text.text = title
	
func setTag(tag : String):
	_tag = tag
